package com.endava.spring.dao_impl;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.endava.spring.beans.Account;

/**
 * Maps the values of accounts from Data Base. Implements interface
 * <code>RowMapper</code>.
 * 
 * @author acojocar
 * @since 30.07.2013
 * @version 1.0
 * 
 */
public class AccountMapper implements RowMapper {

	public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
		Account account = new Account();
		account.setAccountID(rs.getInt("id_account"));
		account.setAccountType(rs.getString("type_account"));
		account.setAmount(rs.getInt("amount"));
		return account;
	}

}
